export default {
	passportHost: 'http://localhost:8080/api/v1',
	// passportHost: 'https://api-passport.czur.cc/api/v1',
	APP_KEY: 'CZUR_FREESCAN',
	HTTP_HEADER_KEY: {
	},
	COOKIE_KEY: {
		'OPENID': 'OPENID',
		'USERID': 'USERID'
	},
	CALL_BACK: '',
	R_CODE: {
		SUCCESS: 1000
	},
	cookieSet: function (key, value) {
		var Days = 30
		var date = new Date()
		date.setTime(date.getTime() + Days * 24 * 60 * 60 * 1000)
		document.cookie = key + '=' + escape(value) + '; path=/;expires = ' + date.toGMTString()
	},
	cookieGet: function (key) {
		var result
		var mycookie = document.cookie
		var start2 = mycookie.indexOf(key + '=')
		if (start2 > -1) {
			var start = mycookie.indexOf('=', start2) + 1
			var end = mycookie.indexOf(';', start)

			if (end === -1) {
				end = mycookie.length
			}

			result = unescape(mycookie.substring(start, end))
		}

		return result
	},
	getReqParam: function (param) {
		var url = window.location.search // 获取url中"?"符后的字串

	    var theRequest = {}
	    if (url.indexOf('?') !== -1) {
	        var str = url.substr(1)
	        var strs = str.split('&')
	        for (var i = 0; i < strs.length; i++) {
	            theRequest[strs[i].split('=')[0]] = decodeURIComponent(strs[i].split('=')[1])
	        }
	    }
	    return theRequest[param]
	},
	appendParam: function (url, param, value) {
		if (url.indexOf('?') >= 0) {
			url = url + '&'
		} else {
			url = url + '?'
		}
		url = url + param + '=' + encodeURIComponent(value)
		return url
	}
}
